// 一级页面
import Home from '../views/Home';
import Detail from '../views/Detail';
import Login from '../views/Login';
import Admin from '../views/Admin';

// 二级页面
import TeacherList from '../views/Admin/Teacher/TeacherList';
import TeacherCate from '../views/Admin/Teacher/TeacherCate';
import StudentList from '../views/Admin/Student/StudentList';
import ProductList from '../views/Admin/Product/ProductList';

const routes = [
    {
        from: '/',
        to: '/home'
    },
    {
        path: '/home',
        component: Home,
        meta: { needLogin: false }
    },
    {
        path: '/admin',
        component: Admin,
        meta: { needLogin: true },
        // 子路由
        children: [
            {
                from: "/admin/teacher",
                to: "/admin/teacher/list"
            },

            {
                path: '/admin/teacher/list',
                component: TeacherList
            },
            {
                path: '/admin/teacher/cate',
                component: TeacherCate
            },
            {
                from: "/admin/student",
                to: "/admin/student/list"
            },
            {
                path: '/admin/student/list',
                component: StudentList
            },
            {
                from: "/admin/product",
                to: "/admin/product/list"
            },

            {
                path: '/admin/product/list',
                component: ProductList
            }
        ]
    },
    {
        path: '/login',
        component: Login,
        meta: { needLogin: false }
    },

    {
        path: '/detail/:id',
        component: Detail,
        meta: { needLogin: false }
    },

]

export default routes;